<?php
$op = get_get("op");
if ($op == "") {
    $op = "requestPage";
}
if ($op == "requestPage") {
    $page = get_get("page");
    if (! $page)
        $page = "add_group";
    if ($page == "add_group") {
        loadTemp("admin/models/permission/add_group.php");
        die();
    }
    if ($page == "edit_user") {
        loadTemp("admin/models/permission/edit_user.php");
        die();
    }
    if ($page == "edit_group") {
        loadTemp("admin/models/permission/edit_group.php");
        die();
    }
}
if ($op == "search_permission") {
    $name = get_post("name");
    if (! $name)
        returnMessage(- 1, "未填写名字");
    $op = get_post("op");
    $data = getPermission($name);
    if (! $data)
        returnMessage(- 2, "权限未找到");
    $back = array();
    $back["op"] = $op;
    $back["data"] = $data;
    returnMessage(0, "权限搜索成功", $back);
}
if ($op == "search_group") {
    $name = get_post("name");
    if (! $name)
        returnMessage(- 1, "未填写名字");
    $op = get_post("op");
    $data = getGroup($name);
    if (! $data)
        returnMessage(- 2, "权限组未找到");
    $back = array();
    $back["op"] = $op;
    $back["data"] = $data;
    returnMessage(0, "权限组搜索成功", $back);
}